package demo1;

import java.util.Arrays;

public class ArraySwap {
    public static void swap(int[] array) {
        int temp = array[0];
        array[0] = array[1];
        array[1] = temp;
    }
    public static void main(String[] args) {
        int[] array = new int[2];
        array[0] = 10;
        array[1] = 20;
        System.out.println("交换前："+Arrays.toString(array));
        swap(array);
        System.out.println("交换后："+Arrays.toString(array));
    }
}
